cmake_minimum_required(VERSION 2.6)
project(FIX_PARSER)

# http://cmake.org/Wiki/CMake_Useful_Variables

# or just make VERBOSE=1
set(CMAKE_VERBOSE_MAKEFILE on)

set(CMAKE_BUILD_TYPE        DEBUG)

# TODO(shl) find a way to solve this, don't have to depend on lib64/ccache, this is just a compilation time speedup.
# using ccache
set(CMAKE_C_COMPILER        /usr/lib64/ccache/gcc)
set(CMAKE_CXX_COMPILER      /usr/lib64/ccache/g++)

# http://www.network-theory.co.uk/docs/gccintro/gccintro_32.html
# http://kerneltrap.org/node/7434
# -Wshadow does it wrong -- removed, but I still kieep -W which is -Wextra now, -Wextra is an alias for -W
set(COMMON_GCC_FLAGS        "-fmessage-length=0 -pedantic-errors -Wall -Wextra -Wconversion -Wcast-qual -Wcast-align -Wwrite-strings -Wlogical-op -Wfatal-errors")

# release/debug C++ compilter flags
set(CMAKE_CXX_FLAGS         "${COMMON_GCC_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS_DEBUG   "-g")

# release/debug C compiler flags
set(CMAKE_C_FLAGS           "${COMMON_GCC_FLAGS} -std=c89")
set(CMAKE_C_FLAGS_DEBUG     "-g")

# http://cmake.org/cmake/help/cmake-2-8-docs.html#module:FindBoost
find_package(Boost)

set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)

add_subdirectory(src/main/fixparser)
add_subdirectory(src/test/fixparser)
#add_subdirectory(src/main/bison)

enable_testing()
add_test(
    NAME        FIX_PARSER_ALL_TESTS_RUN
    COMMAND     FIX_PARSER_ALL_TESTS_EXE
)
